package cn.falconnect.adserver.adapter.persistence;

import javax.annotation.Resource;

import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Repository;

import cn.falconnect.adserver.domain.ad.PlatformAdspaceMap;
import cn.falconnect.adserver.domain.ad.PlatformTagSizeMap;
@Repository
public class TagRepositoryImp implements TagRepository {

	@Resource(name = "cacheRedisTemplate")
	private ValueOperations<String, PlatformTagSizeMap> platformTagSizeMapValueOperations;
	
	@Resource(name = "cacheRedisTemplate")
	private ValueOperations<String, PlatformAdspaceMap> platformAdspaceMapValueOperations;
	

	public PlatformTagSizeMap fetchSizeByTagId(String tagId) {
		return platformTagSizeMapValueOperations.get(PlatformTagSizeMap.cacheTagIdKey(tagId));
	}


	public PlatformAdspaceMap fetchAdspaceByTagId(String tagId,int channel){
		return platformAdspaceMapValueOperations.get(PlatformAdspaceMap.cacheTagIdKey(tagId,channel));
	}

}
